//
//  ZSBContactInfo.m
//  HCNewGoldFinger
//
//  Created by zjhcsoft on 14-10-14.
//  Copyright (c) 2014年 zjhcsoftios. All rights reserved.
//

#import "ZSBContactInfo.h"

@implementation ZSBContactInfo

@synthesize contactType,companyId,sysCompanyRowId,companyName,userName,level,isExpansion,headImgUrl,staName,sysUserRowId,subContactInfoList;

- (instancetype)init
{
    self = [super init];
    if (self) {
        subContactInfoList = [[NSMutableArray alloc] init];
    }
    return self;
}

- (NSString*)description
{
    NSMutableString *description = [NSMutableString stringWithString:@""];
    [description appendFormat:@"<ZSBContactInfo: %p; ", self];
    [description appendFormat:@"contactType = (%i),companyId = (%@),sysCompanyRowId = (%@),companyName = (%@),userName = (%@),level = (%i), isExpansion = (%i),headImgUrl = (%@),staName = (%@),sysUserRowId = (%@), subContactInfoList = (%@)>", contactType,companyId,sysCompanyRowId,companyName,userName,level,isExpansion,headImgUrl,staName,sysUserRowId,subContactInfoList];
    return description;
}

+ (ZSBContactInfo *)readFromDic:(NSDictionary *)dic
{
    ZSBContactInfo *contactInfo = [[ZSBContactInfo alloc] init];
    if ([dic objectForKey:@"companyId"]) {
        contactInfo.companyId = [dic objectForKey:@"companyId"];
    }
    if ([dic objectForKey:@"sysCompanyRowId"]) {
        contactInfo.sysCompanyRowId = [dic objectForKey:@"sysCompanyRowId"];
    }
    if ([dic objectForKey:@"companyName"]) {
        contactInfo.companyName = [dic objectForKey:@"companyName"];
    }
    if ([dic objectForKey:@"companyDefineCd"]) {
        contactInfo.companyDefineCd = [dic objectForKey:@"companyDefineCd"];
    }
    if ([dic objectForKey:@"headImgUrl"]) {
        contactInfo.headImgUrl = [dic objectForKey:@"headImgUrl"];
    }
    if ([dic objectForKey:@"staName"]) {
        contactInfo.staName = [dic objectForKey:@"staName"];
    }
    if ([dic objectForKey:@"level"]) {
        contactInfo.level = [[dic objectForKey:@"level"] intValue];
    }
    return contactInfo;
}

@end
